//
//  BC_ZooRequest.h
//  CocOth
//
//  Created by BrunoCausse on 22/12/10.
//  Copyright 2010-2013 poulailler cie. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@class BC_SplitPoint;

typedef enum  {
	WORKISWAITING,
	SEARCHING,
	STOP,
	TERMINATED,
	KILLED
} request_state;


@interface BC_ZooRequest : NSObject {
		
	BC_SplitPoint *splitpoint;
	
	volatile request_state state;
	
	NSString	*parent;
	NSString	*move;
	
	NSString	*position;
	NSInteger	alpha;
	NSInteger	beta;
	NSUInteger	cut;
	NSUInteger	depth;
	NSUInteger	priority;
	
	NSUInteger	hash;
	
	float		score;
	float		time;
	NSString	*listMoves;
	
	NSCondition *myCondition;
	
}

@property(readonly) NSString *parent, *position;
@property(readwrite, retain) NSString *move; //Copy ????
@property(readonly) NSUInteger depth, hash;
@property(readwrite) volatile request_state state;

@property(readwrite, assign) NSInteger alpha, beta;

@property(readwrite, assign) NSUInteger cut;

@property(readwrite, retain) NSString *listMoves; //Copy ????
@property(readwrite, assign) float score, time;

@property(readonly, assign) BC_SplitPoint *splitpoint;



- (id)initWithPosition:(NSString *)pos;

- (id)initWithPosition:(NSString *)pos 
				  cut:(NSUInteger)selectivity;

- (id)initWithPosition:(NSString *)pos 
				 alpha:(NSInteger)low 
				  beta:(NSInteger)high;

- (id)initWithPosition:(NSString *)pos 
				 alpha:(NSInteger)low 
				  beta:(NSInteger)high 
				   cut:(NSUInteger)selectivity;

- (id)initWithPosition:(NSString *)pos 
				 alpha:(NSInteger)low 
				  beta:(NSInteger)high
				 depth:(NSInteger)aDepth
				   cut:(NSUInteger)selectivity;

- (id)initWithPosition:(NSString *)pos 
				 alpha:(NSInteger)low 
				  beta:(NSInteger)high 
				   cut:(NSUInteger)selectivity
				 depth:(NSInteger)aDepth
				parent:(NSString *)posParent
				  move:(NSString *)aMove;

- (id)initWithPosition:(NSString *)pos 
				 alpha:(NSInteger)low 
				  beta:(NSInteger)high 
				   cut:(NSUInteger)selectivity
				 depth:(NSInteger)aDepth
			  priority:(NSUInteger)aPriority
				parent:(NSString *)posParent
				  move:(NSString *)aMove
			splitpoint:(BC_SplitPoint *)sp;



- (NSString *)request;

- (void)wait;
- (void)signal:(request_state)aState;

- (void)should_stop;




@end
